package com.hawk.eye.common.utils;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

/**
 * @className: JceUtil
 * @description: TODO 类描述
 * @author: salad
 * @date: 2023/10/8
 **/
public class JceUtil {

    public static void removeJceSecurity() {
        Field field;
        try {
            field = Class.forName("javax.crypto.JceSecurity").getDeclaredField("isRestricted");
            field.setAccessible(true);
            Field modifiersField = Field.class.getDeclaredField("modifiers");
            modifiersField.setAccessible(true);
            modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
            field.set(null, false);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }


}
